import router from '@ohos.router';
import prompt from '@ohos.prompt';
export default {
    data: {
        title: "",
        username:"",
        password:""
    },
    onInit() {
        this.title = "Hello World";
    },
    login(){
        if("1"==this.username  && "1" == this.password){
            router.push({
                url:"pages/userinfo/userinfo",
                params:{"loginedUsername":this.username}
            })
        } else{
            prompt.showToast({
                message:"用户名或密码错误",
                duration:5000,
            })
        }

    },
    register(){
        prompt.showToast({
            message:"请注册用户",
            duration:5000,
        })
    },
    usernameChange(event){
        this.username = event.value;
        console.info("username="+this.username);
    },
    passwordChange(event){
        this.password = event.value;
    }
}
